<!--
 * @Descripttion: 
 * @version: @ 1.0.0
 * @Author: 朱江洲
 * @Date: 2022-01-18 11:43:56
 * @LastEditors: 朱江洲
 * @LastEditTime: 2022-01-18 14:30:29
-->
<template>
  <div>
    <el-dialog
      :title="title"
      :visible.sync="dialog.crmInfoShow"
      width="50%"
      @close="crmInfoClose"
    >
      <div v-if="type == 2">
        <el-form>
          <el-form-item label="客户名称："> {{ crmInfo.name }}</el-form-item>
          <el-form-item label="手机号码："> {{ crmInfo.phone }}</el-form-item>
          <el-form-item label="客户行业：">
            {{ crmInfo.industryName }}</el-form-item
          >
          <el-form-item label="线索来源：">
            {{ crmInfo.sourceName }}</el-form-item
          >
          <el-form-item label="客户级别：">
            {{ crmInfo.levelName }}</el-form-item
          >
          <el-form-item label="备注："> {{ crmInfo.remak }}</el-form-item>
          <el-form-item label="地区："> {{ crmInfo.regionName }}</el-form-item>
          <el-form-item label="地址："> {{ crmInfo.address }}</el-form-item>
          <el-form-item label="创建人："> {{ crmInfo.createBy }}</el-form-item>
          <el-form-item label="负责人：">
            {{ crmInfo.directorName }}</el-form-item
          >
          <el-form-item label="创建时间：">
            {{ crmInfo.createTime }}</el-form-item
          >
          <el-form-item label="更新时间：">
            {{ crmInfo.updateTime }}</el-form-item
          >
        </el-form>
      </div>
      <div v-if="type == 6">
        <el-form>
          <el-form-item label="商机名称："> {{ crmInfo.name }}</el-form-item>
          <el-form-item label="客户名称：">
            {{ crmInfo.customer }}</el-form-item
          >
          <el-form-item label="商机金额："> {{ crmInfo.amount }}</el-form-item>
          <el-form-item label="预计成交日期：">
            {{ crmInfo.dealTime }}</el-form-item
          >
          <el-form-item label="商机状态组：">
            {{ crmInfo.opportunityStatusName }}</el-form-item
          >
          <el-form-item label="备注："> {{ crmInfo.remark }}</el-form-item>
          <el-form-item label="创建人："> {{ crmInfo.createBy }}</el-form-item>
          <el-form-item label="负责人：">
            {{ crmInfo.directorName }}</el-form-item
          >
          <el-form-item label="创建时间：">
            {{ crmInfo.createTime }}</el-form-item
          >
          <el-form-item label="更新时间：">
            {{ crmInfo.updateTime }}</el-form-item
          >
        </el-form>
      </div>
      <div v-if="type == 5">
        <el-form>
          <el-form-item label="姓名："> {{ crmInfo.name }}</el-form-item>
          <el-form-item label="客户名称：">
            {{ crmInfo.customer }}</el-form-item
          >
          <el-form-item label="手机号码："> {{ crmInfo.phone }}</el-form-item>
          <el-form-item label="性别："> {{ crmInfo.sex }}</el-form-item>
          <el-form-item label="职务："> {{ crmInfo.post }}</el-form-item>
          <el-form-item label="微信："> {{ crmInfo.wechat }}</el-form-item>
          <el-form-item label="是否关键决策人：">
            {{ crmInfo.leader }}</el-form-item
          >
          <el-form-item label="下次联系时间：">
            {{ crmInfo.education }}</el-form-item
          >
          <el-form-item label="地址："> {{ crmInfo.address }}</el-form-item>
          <el-form-item label="备注："> {{ crmInfo.remark }}</el-form-item>
          <el-form-item label="创建人："> {{ crmInfo.createBy }}</el-form-item>
          <el-form-item label="负责人："> {{ crmInfo.direction }}</el-form-item>
          <el-form-item label="创建时间：">
            {{ crmInfo.createTime }}</el-form-item
          >
          <el-form-item label="更新时间：">
            {{ crmInfo.updataTime }}</el-form-item
          >
        </el-form>
      </div>
      <span slot="footer">
        <el-button @click="dialog.crmInfoShow = false">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    dialog: {
      type: Object,
      required: true,
    },
    crmType: {
      type: [Number, String],
      required: true,
    },
    crmInfo: {
      type: Object,
      required: true,
    },
  },
  watch: {
    crmType: {
      deep: true,
      immediate: true,
      handler(val) {
        if (val == 2) {
          this.title = "客户详情";
          this.type = 2;
        } else if (val == 5) {
          this.title = "联系人详情";
          this.type = 5;
        } else if (val == 6) {
          this.title = "商机详情";
          this.type = 6;
        }
      },
    },
  },
  data() {
    return {
      type: "",
      title: "",
    };
  },
  methods: {
    crmInfoClose() {
      this.dialog.crmInfoShowEject = false;
    },
  },
};
</script>

<style lang="less" scoped>
.el-form {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  .el-form-item {
    width: 50%;
  }
}
</style>